#define _CRT_SECURE_NO_WARNINGS 1
#include<iostream>
#include<vector>
using namespace std;
class Solution {
public:
    int waysToStep(int n) {
        const int aq = 1e9 + 7;
        if (n == 1)
            return 1;
        if (n == 2)
            return 2;
        if (n == 3)
            return 4;
        vector<int> as(n + 1);
        as[1] = 1;
        as[2] = 2;
        as[3] = 4;
        for (int i = 4; i <= n; i++)
        {
            as[i] = ((as[i - 1] + as[i - 2]) % aq + as[i - 3]) % aq;
        }
        return as[n];
    }
};